﻿@model SimpleTaskManager.Domain.Entities.User_Skill

<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@{
    ViewBag.Title = "Skills";
}

<h2>@ViewBag.UserName's Skills</h2>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset id="addSkills">
        <legend>Add Skill</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.SkillId)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.SkillId, 
            (ViewBag.Skills as IEnumerable<SimpleTaskManager.Domain.Entities.Skill>)
              .Select(u => new SelectListItem{Text = u.Name, Value = u.SkillID.ToString()}))
            @Html.ValidationMessageFor(model => model.SkillId)
        </div>
        
        @Html.HiddenFor(model => model.UserId)

        <div style="clear: left;" />

        <p>
            <input type="submit" value="Add" />
        </p>
    </fieldset>
}

 @{ Html.RenderAction("SkillsList", "User", new { id = Model.UserId });}